//
//  JCSecondViewController.m
//  ABookOfCartoon
//
//  Created by dlios on 15-5-14.
//  Copyright (c) 2015年 Power Of Ants. All rights reserved.
//

#import "JCSecondViewController.h"

@interface JCSecondViewController ()
@property (nonatomic, retain)UISlider *slider;
@end

@implementation JCSecondViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"亮度调节";
    

    
    UILabel *NightLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.view.frame.size.width / 4, self.view.frame.size.height / 5, self.view.frame.size.width / 2, 100)];
    NightLabel.text = @"友情提示\n请注意用眼卫生~";
    NightLabel.textAlignment = NSTextAlignmentCenter;
    NightLabel.numberOfLines = 0;
    [self.view addSubview:NightLabel];
    [NightLabel release];
    
    self.slider = [[UISlider alloc] initWithFrame:CGRectMake(self.view.frame.size.width / 4, self.view.frame.size.height / 5 + 200, self.view.frame.size.width / 2, 50)];
    _slider.minimumValue = 0.5;
    _slider.maximumValue = 1.0;
    _slider.value = 1;
    [self.view addSubview:_slider];
    [_slider release];
    [_slider addTarget:self action:@selector(Night:) forControlEvents:UIControlEventValueChanged];
}
- (void)Night:(UISlider *)s
{
    NSLog(@"亮度:%f", s.value);
    self.view.window.alpha = s.value;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
